extends "BaseEntity.gd"
class_name KnightSprite

var knightAniIndex : float = 10;
var knightAniNum : int = 20;

func _init():
    self.position = Vector2(self.x,self.y);

   
    self.texture = load("res://knight.png");

    self.hframes = 10;
    self.vframes = 2;	

    
    self.frame = floor(knightAniIndex);


func _process(_delta):
    if(floor(knightAniIndex) == knightAniNum -1):
        knightAniIndex = 10
    else:
        knightAniIndex = knightAniIndex + 0.3

    self.frame = floor(knightAniIndex);

    if(x >= 800):
        x = 0
    else:
        x = x + xv;
    
    position = Vector2(x,y)